package com.nolon.flange

import android.content.pm.PackageManager
import android.os.Build
import android.os.Bundle
import android.util.Log
import androidx.annotation.RequiresApi
import androidx.appcompat.app.AppCompatActivity
import com.nolon.flange.databinding.ActivityMd5Binding
import n.MD5Utlis

class Main5Activity : AppCompatActivity() {
    val bd by lazy { ActivityMd5Binding.inflate(layoutInflater) }

    @RequiresApi(Build.VERSION_CODES.P)
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(bd.root)

        // Example of a call to a native method
////        var packageInfo = packageManager.getPackageInfo(packageName, PackageManager.GET_SIGNATURES);
////        val signatures = packageInfo.signatures;
////        Log.e("this", signatures[0].toCharsString())
        MD5Utlis.signatureVerify(this)

        bd.sampleText.text = MD5Utlis.signatureParams("phone=15351304173&password=123456")
        /**
         * PackageInfo packageInfo = context.getPackageManager().getPackageInfo(context.getPackageName(), PackageManager.GET_SIGNATURES);
         *   Signature[] signatures = packageInfo.signatures;
         *   return signatures[0].toCharsString();
         */

        val text = packageManager.getPackageInfo(
            "cn.com.nolon",
            PackageManager.GET_SIGNING_CERTIFICATES
        ).signingInfo.apkContentsSigners[0].toCharsString()
        bd.sampleText2.setText(text)
        Log.i(this::class.java.simpleName, text)
    }
}